package com.intretech.tj.etc;


import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

import java.util.Objects;

/**
 * ETC状态
 */

@Getter
public enum State {
    CLOSE(0, "关闭"),
    OPEN(1, "打开");

    @JsonValue
    private final int value;

    private final String chinese;

    State(int value, String chinese) {
        this.value = value;
        this.chinese = chinese;
    }

    public static State valueOf(int value) {
        for (State state : values()) {
            if (Objects.equals(state.value, value)) {
                return state;
            }
        }
        return null;
    }
}
